#include "../include/Configuration.h"

Configuration* Configuration::getInstance() {
    static Configuration instance;
    return &instance;
}

//构造函数，构造开始时就加载配置文件
Configuration::Configuration() {
    _configFilePath = "../data/source/xmlPaper";
    loadConfig();
}




map<string, string> Configuration::getConfigMap() {
    return _configs;
}

string Configuration::getConfigFilePath() {
    return _configFilePath;
}

void Configuration::loadConfig() {
    //std::cout << "Config file path: " << _configFilePath << std::endl;
    for (const auto& entry : fs::directory_iterator(_configFilePath)) {
        //std::cout << "Found file: " << entry.path() << std::endl;
        if (entry.path().extension() == ".xml") {
            _configs[entry.path().filename().string()] = entry.path().string(); //map容器<文件名，路径名>
        }
    }
}


